﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace FourKillEnginePrototype
{
    public class ViewPort
    {
        public double Width { get; set; }
        public double HorizontalViewableAngle { get; set; }
        public double VerticalViewableAngle { get; set; }

        public double DistanceToView
        {
            get
            {
                return (Width / 2d) / Math.Atan(HorizontalViewableAngle);
            }
        }

        public double Height
        {
            get
            {
                return Math.Atan(VerticalViewableAngle) * DistanceToView * 2;
            }
        }

        public bool IsInView(double angle)
        {
            return ((angle >= 0 && angle < HorizontalViewableAngle / 2) || (angle < 0 && (2*Math.PI - angle) < HorizontalViewableAngle / 2));
        }
    }
}
